import QtQuick 2.0
import QtQuick.Templates 2.12
import QtGraphicalEffects 1.14

Popup{              // 弹窗组件 (Android端Windows不好使)
    id: root

    // 显示属性
    parent: Overlay.overlay
    anchors.centerIn: parent
    modal: true
    Overlay.modal: Rectangle{
        color: "#14444444"
    }
    closePolicy: Popup.NoAutoClose

    function show(){
        root.visible = true
    }function close(){
        root.visible = false
    }


    // 样式
    height: 500*dp
    width: 700*dp
    property string title: "提示"

    padding: 10*dp
    topPadding: 40*dp
    // 背景
    background: Rectangle{
        radius: 8*dp
        anchors.fill: parent
        Item{
            height: 40*dp; width: parent.width
            Text{       // 标题
                text: title
                x: 12*dp
                color: "#888888"
                font.pixelSize: config.fontsize
                anchors.verticalCenter: parent.verticalCenter
            }
            Item{       // 关闭按钮
                height: 20*dp; width: 20*dp
                x: parent.width - width - 12*dp
                anchors.verticalCenter: parent.verticalCenter
                MouseArea{
                    anchors.fill: parent
                    cursorShape: Qt.PointingHandCursor
                    onClicked: {
                        root.visible = false
                    }
                }Text{
                    text: "x"
                    anchors.centerIn: parent
                    font.pixelSize: 18*dp
                    color: "#888888"
                }
            }
        }

        // 阴影
        layer.enabled: true
        layer.effect: DropShadow {
            radius: 21*dp
            samples: 43
            transparentBorder: true
            color: "#4D666666"
        }
    }
    // 内容
    contentItem: Item{

    }

}
